package com.example.springcloud;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 主启动类
 */
@Slf4j
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableHystrix
public class OrderMainAppHystrixOn80 {

    /**
     * 主方法
     *
     * @param args the input arguments
     */
    public static void main(String[] args) {

        ConfigurableApplicationContext app = SpringApplication.run(OrderMainAppHystrixOn80.class, args);

        // 得到所有的bean
        String[] beanNames = app.getBeanDefinitionNames();

        StringBuilder beanList = new StringBuilder();

        // 打印容器中所有的组件
        for (int i = 0; i < beanNames.length; i++) {
            beanList.append("\n").append(i + 1).append(" ").append(beanNames[i]);
        }

        log.info(String.valueOf(beanList));
    }

}
